{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 正则化\n",
    "作用是防止过拟合。原理是在损失函数中加入正则化项。于是损失值不再是预测值与标准值之间的差异，还多了一项，进而训练出的模型并不能完全拟合训练样本，从而达到了防止过拟合的效果。在论文中，公式（4）的最后一项就是L2范数的正则化项。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "正则化项是关于模型参数w的计算公式，具体有两种。分别为L1范数和L2范数。L1范数为所有参数值绝对值的和。L2范数为所有参数平方和的平方根。在tensorflow中可以用下边两个计算式计算得到\n",
    "L1范数 tf.reducce_sum(tf.abs(w))\n",
    "L2范数 tf.nn.l2_loss(t, name=None)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda root]",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
